package com.xyx.ssm.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xyx.ssm.dao.SyroleMapper;
import com.xyx.ssm.dao.UserMapper;
import com.xyx.ssm.jdbcdao.SyroleDao;
import com.xyx.ssm.po.SyRole;
import com.xyx.ssm.po.Syroleauthority;
import com.xyx.ssm.service.SyroleService;
import com.xyx.ssm.util.Page;

@Service
public class SyroleServiceImpl implements SyroleService{
   @Autowired
	 private UserMapper userMapper;
   @Autowired 
   private   SyroleDao syroleDao;
   @Autowired
   private SyroleMapper syrolemapper;

public Page<Map<String, Object>> findPage(Page<Map<String, Object>> page) {
	// TODO Auto-generated method stub
	return syroleDao.findPage("com.xyx.ssm.jdbcdao.syroleDao.SelectAllpage",page);
}
public int syroleadd(Map<String,Object> map){
	   return syroleDao.syroleadd(map);
}
@Override
public int syroleDelete(String ids) {
	int n=0;
	   String [] s=ids.split(",");
	           for(int i=0;i<s.length;i++){
	        	   Integer id=Integer.parseInt(s[i]);
	        n=syroleDao.syroleDelete(id);
	           }
	return n;
}
@Override
public int syroleUpdate(SyRole syRole) {
	// TODO Auto-generated method stub
	return syroleDao.syroleUpdate(syRole);
}
@Override
public List<SyRole> syroleId(Integer id) {
	// TODO Auto-generated method stub
	return syroleDao.syroleId(id);
}
@Override
public int insertroleauthority(Syroleauthority ra) {
	// TODO Auto-generated method stub
	return syroleDao.insertroleauthority(ra);
}

@Override
public List<SyRole> selallrole() {
	// TODO Auto-generated method stub
	return syrolemapper.selallrole();
}
@Override
public int deleteall(int userid) {
	// TODO Auto-generated method stub
	return syrolemapper.deleteall(userid);
}   


   
}
